//
//  MZYhotTableViewCell.m
//  WristWatch
//
//  Created by dllo on 15/10/23.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "MZYhotTableViewCell.h"

#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height
@implementation MZYhotTableViewCell

- (void)dealloc {
    [_titleLabel release];
    [_timeLabel release];
    [_readLabel release];
    [_titleImageView release];
    
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView {
    self.titleLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.titleLabel];
    self.titleLabel.numberOfLines = 0;
    //    self.titleLabel.backgroundColor = [UIColor redColor];
    [self.titleLabel release];
    
    self.timeLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.timeLabel];
    self.timeLabel.textColor = [UIColor grayColor];
    //    self.timeLabel.backgroundColor = [UIColor cyanColor];
    [self.timeLabel release];
    
    self.readLabel
    = [[UILabel alloc] init];
    [self.contentView addSubview:self.readLabel];
    self.readLabel.textColor = [UIColor grayColor];
    self.readLabel.textAlignment = 2;
    //    self.brandLabel.backgroundColor = [UIColor yellowColor];
    [self.readLabel release];
    
    self.titleImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:self.titleImageView];
    //    self.titleImageView.backgroundColor = [UIColor orangeColor];
    [self.titleImageView release];
    
}

- (void)layoutSubviews {
    [super layoutSubviews];
    NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:18], NSFontAttributeName, nil];
    CGRect rect = [self.titleLabel.text boundingRectWithSize:CGSizeMake(WIDTH / 25 * 17, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    self.titleLabel.frame = CGRectMake(WIDTH / 25 * 7, HEIGHT / 12, WIDTH / 25 * 17, rect.size.height);
    self.titleLabel.font = [UIFont systemFontOfSize:18];
    self.titleLabel.font = [UIFont boldSystemFontOfSize:18.0];
    self.timeLabel.frame = CGRectMake(WIDTH / 25 * 7, rect.size.height + 10, WIDTH / 25 * 10, HEIGHT / 5);
    self.readLabel.frame = CGRectMake(WIDTH / 25 * 11, rect.size.height + 10, WIDTH / 25 * 13, HEIGHT / 5);
    self.titleImageView.frame = CGRectMake(WIDTH / 25 - 5, HEIGHT / 12, WIDTH / 25 * 6, HEIGHT / 4 * 3);
    
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
